﻿package {
	import com.gameLogic.actor.Player;
	import com.gameLogic.manager.InputManager;
	import com.gameLogic.scene.Camera2D;
	import com.gameLogic.scene.LayerEnum;
	import com.gameLogic.scene.SceneManager;
	import com.gameLogic.scene.WorldMap;
	import com.gameLogic.utils.GameConfig;
	
	import laya.display.Stage;
	import laya.utils.Stat;

	public class LayaSample 
	{
		
		private var camera:Camera2D;
		
		public function LayaSample()
		{
			//初始化引擎
			//Laya.init(1136, 640);
			Laya3D.init(GameConfig.DeviceW, GameConfig.DeviceH,true);
			Laya.stage.scaleMode = Stage.SCALE_FULL;
			//Laya.stage.screenMode = Stage.SCREEN_NONE;
			Laya.stage.screenMode = Stage.SCREEN_HORIZONTAL;
			Stat.show();
			Laya.stage.bgColor = "#cccccc";
			
			InputManager.instance.init();
			SceneManager.instance.init();
			SceneManager.instance.addToLayer(WorldMap.instance.container, LayerEnum.MapLayer);
			SceneManager.instance.addToLayer(Player.instance.disObj, LayerEnum.ActorLayer, 1024, 1024);
			SceneManager.instance.camera.focus(Player.instance.disObj);
			
			Laya.timer.frameLoop(GameConfig.FrameLoopDelay, this, update);
		}
		
		private function update():void
		{
			SceneManager.instance.update();
			WorldMap.instance.update();
		}
		
	}
}